Skip to content

Surface real /api/gmaps/key error status on the frontend - #31

Merged
timothylee58 merged 1 commit into
mainfrom
claude/gmaps-error-visibility
Aug 2, 2026
Merged

Surface real /api/gmaps/key error status on the frontend#31
timothylee58 merged 1 commit into
mainfrom
claude/gmaps-error-visibility

Conversation

@timothylee58

@timothylee58 timothylee58 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

fetch() never rejects on non-2xx responses, so backend/public/app.js's .then(r => r.json()) on a 403 (origin mismatch) or 503 (key not configured) response from /api/gmaps/key silently parsed the error body without checking r.ok. The catch block then always logged the same generic "No Google Maps API key returned" message regardless of which of the two real causes was in play — making it impossible to diagnose from the browser console alone (this is exactly what the user hit after rotating their Maps key).

Fix

app.js now reads r.ok/r.status alongside the parsed body and surfaces the actual backend error message and HTTP status in both the console error and the on-page banner, e.g. Map unavailable: Forbidden (HTTP 403) vs Map unavailable: Google Maps API key not configured (HTTP 503).

Test plan

  • npm test — 119/119 passing (no test coverage for this static frontend file; verified by reading the diff and cross-checking against weatherProxyController.js's two error response shapes)

Generated by Claude Code


Note

Low Risk
Small change to static frontend error handling for the Maps key fetch; no auth or data-path changes.

Overview
Fixes misleading map load errors when /api/gmaps/key returns non-2xx responses (e.g. 403 origin mismatch or 503 missing key). The bootstrap fetch now inspects response.ok and status alongside the JSON body instead of only checking for data.key.

On failure, it throws with the backend error message and HTTP status, and showMapLoadError / the console log show that text instead of always blaming a missing GOOGLE_MAPS_API_KEY.

Reviewed by Cursor Bugbot for commit e2cfe3b. Configure here.


Summary by cubic

Surface the real error status and message from /api/gmaps/key on the frontend so map failures are clear, not generic. We now show the HTTP status and backend message in both the console and the on-page banner.

  • Bug Fixes
    • Check r.ok and r.status before using the response; display the backend error and HTTP code in the console and the banner.

Written for commit e2cfe3b. Summary will update on new commits.

Review in cubic

fetch() never rejects on non-2xx status, so 'r.json()' on a 403
(Forbidden — origin mismatch) or 503 (key not configured) response
silently parsed the error body without checking r.ok. The catch
block then always logged the same generic 'No Google Maps API key
returned' regardless of the real cause, making it impossible to
diagnose from the browser console alone.

Now checks r.ok/r.status and surfaces the actual error message and
HTTP status in both the console error and the on-page banner.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dae1fa30-7a87-4a17-b2f2-85a78a4483d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_2684c6af-9cb2-4ed7-93be-971db60e335f)

@timothylee58
timothylee58 marked this pull request as ready for review August 2, 2026 17:10
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@timothylee58
timothylee58 merged commit d572dba into main Aug 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants